# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=logtop
pkgver=0.7
pkgrel=0
pkgdesc="Display real time statistics of whatever you want"
url="https://github.com/JulienPalard/logtop/"
arch="all"
license="BSD-3-Clause"
makedepends="
	ncurses-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3
	python3-dev
	swig
	uthash-dev
	"
subpackages="
	$pkgname-doc
	$pkgname-libs
	py3-$pkgname-pyc
	py3-$pkgname:python
	"
source="https://github.com/JulienPalard/logtop/archive/refs/tags/logtop-$pkgver.tar.gz"
options="!check" # no test suite
builddir="$srcdir/$pkgname-$pkgname-$pkgver"

build() {
	CFLAGS="$CFLAGS -DVERSION=$pkgver" \
	make

	make liblogtop

	swig -python ./*.i
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

package() {
	install -vDm755 logtop -t "$pkgdir"/usr/bin
	install -vDm644 liblogtop.so "$pkgdir"/usr/lib/liblogtop.so.0
	install -vDm644 doc/logtop.1 "$pkgdir"/usr/share/man/man1/logtop.1

	python3 -m installer -d "$pkgdir" \
		"$builddir"/.dist/*.whl
}

python() {
	pkgdesc="$pkgdesc (Python bindings)"
	amove usr/lib/python*
}

sha512sums="
aa9fe40535033594c0ff246918377b8a6604ff79b29bf462262887efabab235d99070e8fd23bccbdeeb5c15e0949fa63a58cfcb98f29eb4398b0cc3db4039ae8  logtop-0.7.tar.gz
"
